package com.tangruojie.stream;

import com.tangruojie.entity.Author;

import java.util.List;
import java.util.function.Consumer;
import java.util.function.Predicate;

/**
 * 中间操作之 filter 过滤
 */
public class StreamDemo02 {

    public static void main(String[] args) {

        List<Author> authors = StreamDemoTest.getAuthors();

        /**
         * 筛选作者姓名长度大于1的作者
         */
        authors.stream()
                .distinct()
                .filter(author -> author.getName().length() > 1)
                .forEach(author -> System.out.println(author.getName()));

    }

}
